package hDOJ;

import java.util.Scanner;

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n= sc.nextInt();
        sc.nextLine();
        while(n--!=0){
            int count=0;
            String str=sc.nextLine();//next()会将空格、Tab、Enter等字符去掉
            byte []by=str.getBytes();
            for(int i=0;i<by.length;i++){
                if(by[i]<0){
                    count++;
                }
            }
            System.out.println(count/2);
            //n--;
        }
    }
}
